<?php
$ma_nganh=$_GET['manganh'];
$ma_donvi=$_GET['donvi'];
$namkhoahoc=$_GET['namkhoahoc'];
include('../../configs/connect.php');   
mysql_query("SET NAMES 'UTF8'");
            
    $sql1="  SELECT ma_nhaphoc,tbl_nhaphoc.ma_sv,hoten_sv, gioitinh_sv, ngaysinh_sv
                FROM tbl_nhaphoc, tbl_sinhvien, tbl_donvi, tbl_donvi_ctdt, tbl_ctdt, tbl_khoahoc
                WHERE tbl_nhaphoc.ma_sv = tbl_sinhvien.ma_sv
                    AND tbl_nhaphoc.ma_donvi = tbl_donvi.ma_donvi = tbl_donvi_ctdt.ma_donvi
                    AND tbl_donvi_ctdt.ma_ctdt = tbl_ctdt.ma_ctdt
                    AND tbl_nhaphoc.id_khoahoc = tbl_khoahoc.id_khoahoc
                    AND tbl_khoahoc.id_dv_ctdt = tbl_donvi_ctdt.id_dv_ctdt
                    AND nam_khoahoc='$namkhoahoc'
                    AND tbl_nhaphoc.ma_donvi='$ma_donvi'
                    AND madm_nganh = '$ma_nganh'
                    AND ma_nhaphoc NOT IN (SELECT ma_nhaphoc from tbl_sv_lop)
                LIMIT 0,20";
                    
    $result = mysql_query($sql1) or die(mysql_error());
 
 echo "<table class='danhsach' id='danhsach'>
        <tr id='b'>
            <th class='td-54'>STT</th>
            <th class='td-94'>Mã SV</th>
            <th class='td-130'>Họ tên</th>
            <th class='td-42'>GT</th>
            <th class='td-79'>Ngày sinh</th>
        </tr>";
    $i=0;
    while($row = mysql_fetch_array($result))
        {
            $i+=1;
            echo "<tr>";
                echo "<td>".$i."<input type='checkbox' value=".$row['0']." class='sv-item'/></td>";
                echo "<td >" . $row['1'] . "</td>";
                echo "<td>" . $row['2'] . "</td>";
                echo "<td>" . $row['3'] . "</td>";
                echo "<td>" . $row['4'] . "</td>";
            echo "</tr>";          
        }
echo "</table>";  
?>